﻿using System.Configuration;

namespace Pixeldyne.Core.Configuration
{
	/// <summary>
	/// Generic config list element.
	/// </summary>
	public class ListConfigElement : ConfigurationElement
	{
		const string VALUE_ATTRIBUTE = "value";

		/// <summary>
		/// Initialises a new instance of the <see cref="ListConfigElement"/> class.
		/// </summary>
		/// <param name="newValue">The new value.</param>
		public ListConfigElement(string newValue)
		{
			Value = newValue;
		}

		/// <summary>
		/// Initialises a new instance of the <see cref="ListConfigElement"/> class.
		/// </summary>
		public ListConfigElement()
		{
		}

		/// <summary>
		/// Gets or sets the value.
		/// </summary>
		[ConfigurationProperty(VALUE_ATTRIBUTE, IsRequired = true, IsKey = false)]
		public string Value
		{
			get
			{
				return (string)this[VALUE_ATTRIBUTE];
			}

			set
			{
				this[VALUE_ATTRIBUTE] = value;
			}
		}
	}
}
